<?php

namespace app\admin\validate;

use think\Validate;

class ProductionRecipeProcess extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'carrier_spec' => 'require|max:255',
        'production_speed' => 'require|float',
        'unwinding_tension' => 'require|float',
        'injection_machine' => 'require|max:255',
        'mixer_number' => 'require|max:255',
        'mixing_plate_number' => 'require|max:255',
        'filter' => 'require|in:过滤网1号,过滤网2号',
        'injection_hose' => 'require|max:255',
        'static_mixer_size' => 'require|max:255',
        'responsible_person' => 'require|integer',
        'status' => 'integer',
        'remark' => 'max:65535'
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'carrier_spec.require' => '载体规格不能为空',
        'carrier_spec.max' => '载体规格不能超过255个字符',
        'production_speed.require' => '生产速度不能为空',
        'production_speed.float' => '生产速度必须是数字',
        'unwinding_tension.require' => '张力不能为空',
        'unwinding_tension.float' => '张力必须是数字',
        'injection_machine.require' => '注塑机不能为空',
        'injection_machine.max' => '注塑机不能超过255个字符',
        'mixer_number.require' => '搅拌机号不能为空',
        'mixer_number.max' => '搅拌机号不能超过255个字符',
        'mixing_plate_number.require' => '搅拌盘编号不能为空',
        'mixing_plate_number.max' => '搅拌盘编号不能超过255个字符',
        'filter.require' => '过滤网不能为空',
        'filter.in' => '过滤网必须是过滤网1号或过滤网2号',
        'injection_hose.require' => '注塑软管不能为空',
        'injection_hose.max' => '注塑软管不能超过255个字符',
        'static_mixer_size.require' => '静态混合器尺寸不能为空',
        'static_mixer_size.max' => '静态混合器尺寸不能超过255个字符',
        'responsible_person.require' => '负责人不能为空',
        'responsible_person.integer' => '负责人必须是数字',
        'status.integer' => '状态必须是数字',
        'remark.max' => '备注不能超过65535个字符'
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['carrier_spec', 'production_speed', 'unwinding_tension', 'injection_machine', 'mixer_number', 'mixing_plate_number', 'filter', 'injection_hose', 'static_mixer_size', 'responsible_person'],
        'edit' => ['carrier_spec', 'production_speed', 'unwinding_tension', 'injection_machine', 'mixer_number', 'mixing_plate_number', 'filter', 'injection_hose', 'static_mixer_size', 'responsible_person'],
    ];

}